/**
 *  Desc:   用户中心对应的请求封装文件
 *  Author: 姜玉林
 *  Date:   2020-01-20 11:33
 */

import request from '@/utils/request';
import {removeEmptyKeys} from "@/utils/utils";

// 获取用户列表
export async function fetchList(params) {
    params = removeEmptyKeys(params)
    return request.get('/api/admin/userList', {
        params
    })
}

// 获取用户信息
export async function loadUserDetail(id) {
  return request.get(`/api/admin/userParents/${id}`)
}

// 更新用户信息
export async function updateUserInfo(params) {
  const {id} = params;
  return request(`/api/admin/userParents/${id}`, {
    method: 'POST',
    data: params
  })
}

// 修改用户账号状态
export async function patchUserInfo(params) {
  const {id} = params;
  return request(`/api/admin/userParents/${id}`, {
    getResponse: true,
    method: 'PATCH',
    data: params
  })
}

// 全部用户
export async function getAllUser() {
  return request.get(`/api/admin/getAllUser`)
}


